from django.conf.urls import url
from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import obtain_jwt_token

from meiduo_admin.good import sku_images_views
from meiduo_admin.good import spec_options_views
from meiduo_admin.good import spec_views
from meiduo_admin.good import spu_views
from meiduo_admin.home import views
from meiduo_admin.user import user_views
from meiduo_admin.good import good_views


urlpatterns = [
    url(r'^authorizations/$', obtain_jwt_token),
    # 首页
    url(r'^statistical/total_count/$', views.UserTotalCountView.as_view()),
    url(r'^statistical/day_increment/$', views.UserIncrementCountView.as_view()),
    url(r'^statistical/day_active/$', views.UserDayActiveCountView.as_view()),
    url(r'^statistical/day_orders/$', views.UserDayOrderCountView.as_view()),
    url(r'^statistical/month_increment/$', views.UserMonthIncreamentCountView.as_view()),
    url(r'^statistical/goods_day_views/$', views.UserGoodsVisitCountView.as_view()),
    # 用户
    url(r'^users/$', user_views.UserView.as_view()),
    # sku
    url(r'^skus/categories/$',good_views.SKUCategoryView.as_view()),
    url(r'^goods/simple/$',good_views.SKUGoodSimpleView.as_view()),
    url(r'^goods/(?P<spu_id>\d+)/specs/$',good_views.SKUGoodsSpecsView.as_view()),
    # spu
    url(r'^goods/brands/simple/$',spu_views.SPUBrandSimpleView.as_view()),
    url(r'^goods/channel/categories/$',spu_views.SPUCategoryView.as_view()),
    url(r'^goods/channel/categories/(?P<category_id>\d+)/$',spu_views.SPUCategorySubView.as_view()),
    url(r'^goods/images/$',spu_views.SPUImageUploadView.as_view()),
    # spec
    url(r'^goods/specs/simple/$',spec_options_views.OptionSpecView.as_view()),
    # images
    url(r'^skus/simple/$',sku_images_views.SKUImageViewSet.as_view({"get":"simple"}))

]

# 7,/skus/images/
router = DefaultRouter()
router.register(r'skus/images',sku_images_views.SKUImageViewSet,base_name="images")
urlpatterns += router.urls

# 3,sku
router = DefaultRouter()
router.register(r'skus',good_views.SKUViewSet,base_name="skus")
urlpatterns += router.urls

# 5,/goods/specs/
router = DefaultRouter()
router.register(r'goods/specs',spec_views.SpecViewSet,base_name="specs")
urlpatterns += router.urls

# 3,spu
router = DefaultRouter()
router.register(r'goods',spu_views.SPUViewSet,base_name="goods")
urlpatterns += router.urls

# 6,/specs/options/
router = DefaultRouter()
router.register(r'specs/options',spec_views.SpecsOptionsVieSet,base_name='options')
urlpatterns += router.urls

